<?php
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_1',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="breakingNews">',
'after_title' => '</h3>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_2',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="breakingNews">',
'after_title' => '</h3>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_3',
'before_widget' => '<div class="widget innerPost">',
'after_widget' => '</div>',
'before_title' => '<h2 class="innerPostTitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_4',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h2 class="subnewsEntryTitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_5',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h2 class="subnewsEntryTitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_6',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h2 class="subnewsEntryTitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_7',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h2 class="subnewsEntryTitle">',
'after_title' => '</h2>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_8',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgetTitle">',
'after_title' => '</h3>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_9',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgetTitle">',
'after_title' => '</h3>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_10',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgetTitle">',
'after_title' => '</h3>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_11',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgetTitle">',
'after_title' => '</h3>',
));
if ( function_exists('register_sidebar') )
register_sidebar(array('name'=>'WpNewspaper_12',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widgetTitle">',
'after_title' => '</h3>',
));
function string_limit_words($string, $word_limit)
{
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit)
array_pop($words);
return implode(' ', $words);
}
include (TEMPLATEPATH . '/translations/current.php');
class ControlPanel {

	/********************************************************
	Create a unique array that contains all theme settings
	********************************************************/
	var $default_settings = Array(
		'style' => 'default',
		'titleFirstName' => 'Vladimir Putin',
		'titleFirstQuote' => 'We discussed this important issue yesterday over a beer...',
		'titleSecondName' => 'Barack OBAMA',
		'titleSecondQuote' => 'You know, my faith is one that admits some doubt...',
		'titleSiteNameFirstRow' => 'WORDPRESS',
		'titleSiteNameSecondRow' => 'NEWSPAPER',
		'quoteFirstImageName' => 'putin.jpg',
		'quoteSecondImageName' => 'obama.gif',
		'titleBreakingNews' => 'BREAKING NEWS',
		'breakingNewsPostCount' => 12,
		'excludeCategories' => '',
		'enablePhotoGallery' => 1,
		'enableLeftQuote' => 1,
		'enableVideo' => 1,
		'videoCatID' => '',
		'videoPostCount' => '1',
		'videoPostCountArc' => '4',
		'enableRightQuote' => 1,
		'switchheader' => 1,
		'enableRightQuote' => 1,
		'enableFeedburner' => 1,
		'enableLinkLeftQ' => 0,
		'enableLinkRightQ' => 0,
		'leftQuoteLink' => '',
		'rightQuoteLink' => '',
		'feedburnerID' => '',
		'mpPhotoGalCatID' => '',
		'featuredCatID' => '',
		'sub1stCatID' => '',
		'sub2ndCatID' => '',
		'sub3rdCatID' => '',
		'sub4thCatID' => '',
		'sub5thCatID' => '',
		'order' => 'DESC',
		'orderBy' => 'ID',
		'ad300x250' => 'Insert your 300x250px ad code here',
		'ad728x90' => 'Insert your 728x90px ad code here',
		'ad250x250' => 'Insert your 250x250 ad code here',
		'ad120x600' => 'Insert your 250x250 ad code here',
		'adh468x60' => 'Insert your 468x60 ad code here',
		
		'DGTstyle' => 'default',
		'DGTtitleFirstName' => 'Vladimir Putin',
		'DGTtitleFirstQuote' => 'We discussed this important issue yesterday over a beer...',
		'DGTtitleSecondName' => 'Barack OBAMA',
		'DGTtitleSecondQuote' => 'You know, my faith is one that admits some doubt...',
		'DGTtitleSiteNameFirstRow' => 'WORDPRESS',
		'DGTtitleSiteNameSecondRow' => 'NEWSPAPER',
		'DGTquoteFirstImageName' => 'putin.jpg',
		'DGTquoteSecondImageName' => 'obama.gif',
		'DGTtitleBreakingNews' => 'BREAKING NEWS',
		'DGTbreakingNewsPostCount' => 12,
		'DGTexcludeCategories' => '',
		'DGTenablePhotoGallery' => 1,
		'DGTenableLeftQuote' => 1,
		'DGTenableVideo' => 1,
		'DGTvideoCatID' => '',
		'DGTvideoPostCount' => '1',
		'DGTvideoPostCountArc' => '4',
		'DGTenableRightQuote' => 1,
		'DGTswitchheader' => 1,
		'DGTenableRightQuote' => 1,
		'DGTenableFeedburner' => 1,
		'DGTenableLinkLeftQ' => 0,
		'DGTenableLinkRightQ' => 0,
		'DGTleftQuoteLink' => '',
		'DGTrightQuoteLink' => '',
		'DGTfeedburnerID' => '',
		'DGTmpPhotoGalCatID' => '',
		'DGTfeaturedCatID' => '',
		'DGTsub1stCatID' => '',
		'DGTsub2ndCatID' => '',
		'DGTsub3rdCatID' => '',
		'DGTsub4thCatID' => '',
		'DGTsub5thCatID' => '',
		'DGTorder' => 'DESC',
		'DGTorderBy' => 'ID',
		'DGTad300x250' => 'Insert your 300x250px ad code here',
		'DGTad728x90' => 'Insert your 728x90px ad code here',
		'DGTad250x250' => 'Insert your 250x250 ad code here',
		'DGTad120x600' => 'Insert your 250x250 ad code here',
		'DGTadh468x60' => 'Insert your 468x60 ad code here',
	);
	
	var $options;
	function ControlPanel() {
       	add_action('admin_menu', array(&$this, 'add_menu'));
        	add_action('admin_head', array(&$this, 'admin_head'));

        	if (!is_array(get_option('WpNewspaper')))
        	add_option('WpNewspaper', $this->default_settings);
        
        	$this->options = get_option('WpNewspaper');
	}

    	function add_menu() {
        	add_theme_page('Setting for Sanh Dieu page', 'Sanhdieu Setting', 'edit_themes', "WpNewspaper", array(&$this, 'optionsmenu'));
			add_theme_page('Setting for Dep - Giai Tri page', 'DepGiaitri Setting', 'edit_themes', "WpNewspaper2", array(&$this, 'optionsmenu2'));
    	}

    	function admin_head() {
			print '
			<style type="text/css" media="screen">@import url( ' .get_template_directory_uri(). '/styles/controlpanel.css );</style>';
			}
	
	function optionsmenu() {
	if ($_POST['ss_action'] == 'save') {
		$this->options["titleFirstName"] = $_POST['cp_titleFirstName'];
		$this->options["titleFirstQuote"] = $_POST['cp_titleFirstQuote'];
		$this->options["quoteFirstImageName"] = $_POST['cp_quoteFirstImageName'];
		$this->options["titleSecondName"] = $_POST['cp_titleSecondName'];
		$this->options["titleSecondQuote"] = $_POST['cp_titleSecondQuote'];
		$this->options["quoteSecondImageName"] = $_POST['cp_quoteSecondImageName'];
		$this->options["titleSiteNameFirstRow"] = $_POST['cp_titleSiteNameFirstRow'];
		$this->options["titleSiteNameSecondRow"] = $_POST['cp_titleSiteNameSecondRow'];
		$this->options["titleBreakingNews"] = $_POST['cp_titleBreakingNews'];
		$this->options["breakingNewsPostCount"] = $_POST['cp_breakingNewsPostCount'];
		$this->options["excludeCategories"] = $_POST['cp_excludeCategories'];
       	$this->options["enablePhotoGallery"] = isset($_POST['cp_enablePhotoGallery']) ? 1 : 0;
		$this->options["mpPhotoGalCatID"] = $_POST['cp_mpPhotoGalCatID'];
		$this->options["featuredCatID"] = $_POST['cp_featuredCatID'];
		$this->options["sub1stCatID"] = $_POST['cp_sub1stCatID'];
		$this->options["sub2ndCatID"] = $_POST['cp_sub2ndCatID'];
		$this->options["sub3rdCatID"] = $_POST['cp_sub3rdCatID'];
		$this->options["sub4thCatID"] = $_POST['cp_sub4thCatID'];
		$this->options["feedburnerID"] = $_POST['cp_feedburnerID'];
		$this->options["orderBy"] = $_POST['cp_orderBy'];
		$this->options["order"] = $_POST['cp_order'];
		$this->options["leftQuoteLink"] = $_POST['cp_leftQuoteLink'];
		$this->options["rightQuoteLink"] = $_POST['cp_rightQuoteLink'];		
		$this->options["ad120x600"] = stripslashes($_POST['cp_ad120x600']);
		$this->options["ad728x90"] = stripslashes($_POST['cp_ad728x90']);
		$this->options["ad250x250"] = stripslashes($_POST['cp_ad250x250']);
		$this->options["ad300x250"] = stripslashes($_POST['cp_ad300x250']);
		$this->options["adh468x60"] = stripslashes($_POST['cp_adh468x60']);	
		$this->options["videoPostCount"] = $_POST['cp_videoPostCount'];
		$this->options["videoPostCountArc"] = $_POST['cp_videoPostCountArc'];
		$this->options["videoCatID"] = $_POST['cp_videoCatID'];
		$this->options["style"] = $_POST['cp_style'];	
		$this->options["enableLinkLeftQ"] = isset($_POST['cp_enableLinkLeftQ']) ? 1 : 0;
		$this->options["enableVideo"] = isset($_POST['cp_enableVideo']) ? 1 : 0;
		$this->options["enableLinkRightQ"] = isset($_POST['cp_enableLinkRightQ']) ? 1 : 0;	
		$this->options["switchheader"] = isset($_POST['cp_switchheader']) ? 1 : 0;
		$this->options["enableRightQuote"] = isset($_POST['cp_enableRightQuote']) ? 1 : 0;
        update_option('WpNewspaper', $this->options);
	echo '<div class="updated fade" id="message" style="background-color: rgb(255, 251, 204); width: 500px; margin-left: 50px"><p>WpNewspaper settings <strong>saved</strong>.</p></div>';
	}

	echo '<div id="optionsForm">
	<form action="" method="post" id="themeform">
	<fieldset>
    <input type="hidden" id="ss_action" name="ss_action" value="save">	
		<p>Please <strong>do not use non-english</strong> characters on control panel.</p>
	
		<h3>Select Style that you would like to use on your theme</h3>
		<input class="inputNormal" name="cp_style" id="cp_style" type="text" value="'.$this->options["style"].'" /><label for="cp_style">Enter the name of style you want to use . Options are <strong>default, default-gray, sans, sans-gray</strong> (cAsE sEnSiTiVe)</label><br /><br />
		
		<div class="optionsWide" id="panel1">
			<h3>Setup Header</h3>
			<p>We have two headers available, one is the current version that you see on <a href="http://www.wpnewspaper.com">live demo</a> that is named as <strong>Header with quotes</strong> and second header where quotes are being removed, the site name is moved to left corner and a 468x60 px ad spot is placed on right side of header. This header is named as <strong>Header with Ads</strong></p>
			<p>Setup header below</p>
			<input class="inputNormal" name="cp_titleSiteNameFirstRow" id="cp_titleSiteNameFirstRow" type="text" value="'.$this->options["titleSiteNameFirstRow"].'" /><label for="cp_titleSiteNameFirstRow">Enter the sitename that you want to display on first Row (WordPress is shown on live demo) (UPPERCASE is recomended)</label><br />
			<input class="inputNormal" name="cp_titleSiteNameSecondRow" id="cp_titleSiteNameSecondRow" type="text" value="'.$this->options["titleSiteNameSecondRow"].'" /><label for="cp_titleSiteNameSecondRow">Enter the sitename that you want to display on second row (Newspaper is shown on live demo) (UPPERCASE is recomended)</label><br /><br />
			<input type="checkbox" name="cp_switchheader" id="cp_switchheader"'.($this->options["switchheader"] == 1 ? ' checked' : '').' /><label for="cp_switchheader">Switch header: When this box is selected, <strong>header with quotes</strong> will be active, when it is not, <strong>header with ad</strong> will be active</label><br />
			
			<div style="padding:10px;border:1px solid #aaa;margin-top:20px;">
				<p class="highlight">If <strong>header with ad</strong> is activated, you dont need to change anything below</p><br />
				
				<input type="checkbox" name="cp_enableLeftQuote" id="cp_enableLeftQuote"'.($this->options["enableLeftQuote"] == 1 ? ' checked' : '').' /><label for="cp_enableLeftQuote">Enable Left Quote on header</label><br />
				<input type="checkbox" name="cp_enableLinkLeftQ" id="cp_enableLinkLeftQ"'.($this->options["enableLinkLeftQ"] == 1 ? ' checked' : '').' /><label for="cp_enableLinkLeftQ">Check this box if you would like to add a link to left quote on header</label><br />
				<input class="inputNormal" name="cp_leftQuoteLink" id="cp_leftQuoteLink" type="text" value="'.$this->options["leftQuoteLink"].'" /><label for="cp_leftQuoteLink">Enter the link for left quote (only if link for left quote activated)</label><br />
				<input class="inputNormal" name="cp_titleFirstName" id="cp_titleFirstName" type="text" value="'.$this->options["titleFirstName"].'" /><label for="cp_titleFirstName">Enter the text that you want to display in red for the left quote section</label><br />
				<input class="inputNormal" name="cp_titleFirstQuote" id="cp_titleFirstQuote" type="text" value="'.$this->options["titleFirstQuote"].'" /><label for="cp_titleFirstQuote">Enter the quote for the left section</label><br />
				<input class="inputNormal" name="cp_quoteFirstImageName" id="cp_quoteFirstImageName" type="text" value="'.$this->options["quoteFirstImageName"].'" /><label for="cp_quoteFirstImageName">Image for left quote. Upload your image (not wider than 85px and not higher than 100px) into images folder and write image name here</label><br /><br />
				
				<input type="checkbox" name="cp_enableRightQuote" id="cp_enableRightQuote"'.($this->options["enableRightQuote"] == 1 ? ' checked' : '').' /><label for="cp_enableRightQuote">Enable Right Quote on header</label><br />
				<input type="checkbox" name="cp_enableLinkRightQ" id="cp_enableLinkRightQ"'.($this->options["enableLinkRightQ"] == 1 ? ' checked' : '').' /><label for="cp_enableLinkRightQ">Check this box if you would like to add a link to right quote on header</label><br />
				<input class="inputNormal" name="cp_rightQuoteLink" id="cp_rightQuoteLink" type="text" value="'.$this->options["rightQuoteLink"].'" /><label for="cp_rightQuoteLink">Enter the link for right quote (only if link for right quote activated)</label><br />
				<input class="inputNormal" name="cp_titleSecondName" id="cp_titleSecondName" type="text" value="'.$this->options["titleSecondName"].'" /><label for="cp_titleSecondName">Enter the text that you want to display in red for the right quote</label><br />
				<input class="inputNormal" name="cp_titleSecondQuote" id="cp_titleSecondQuote" type="text" value="'.$this->options["titleSecondQuote"].'" /><label for="cp_titleSecondQuote">Enter the quote for the right section</label><br />
				<input class="inputNormal" name="cp_quoteSecondImageName" id="cp_quoteSecondImageName" type="text" value="'.$this->options["quoteSecondImageName"].'" /><label for="cp_quoteSecondImageName">Image for right quote. Upload your image (not wider than 85px and not higher than 100px) into images folder and write image name here</label><br />
			</div>
			
		</div>
		
		<div class="optionsWide" id="panel2">
			<h3>Setup Categories</h3>
			<h5>Enter the ID of categories those are going to show on the homepage. <a href="http://www.gabfirethemes.com/how-to-check-category-ids/" target="_blank">Read this post</a> if you dont know how to check ID of a category</h5>
			<input class="inputNormal" style="width:40px" name="cp_featuredCatID" id="cp_featuredCatID" type="text" value="'.$this->options["featuredCatID"].'" /><label for="cp_featuredCatID">Featured area Category ID</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub1stCatID" id="cp_sub1stCatID" type="text" value="'.$this->options["sub1stCatID"].'" /><label for="cp_sub1stCatID">Enter Category ID for first column below the featured photo gallery (Travel section on live demo)</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub2ndCatID" id="cp_sub2ndCatID" type="text" value="'.$this->options["sub2ndCatID"].'" /><label for="cp_sub2ndCatID">Enter Category ID for second column below the featured photo gallery (Politics section on live demo)</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub3rdCatID" id="cp_sub3rdCatID" type="text" value="'.$this->options["sub3rdCatID"].'" /><label for="cp_sub3rdCatID">Enter Category ID for third column below the featured photo gallery (Sports section on live demo)</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub4thCatID" id="cp_sub4thCatID" type="text" value="'.$this->options["sub4thCatID"].'" /><label for="cp_sub4thCatID">Enter Category ID for fourth column below the featured photo gallery (World News section on live demo)</label><br />
			
			<h5>Enable / Disable Photo Gallery</h5>
			<input type="checkbox" name="cp_enablePhotoGallery" id="cp_enablePhotoGallery"'.($this->options["enablePhotoGallery"] == 1 ? ' checked' : '').' /><label for="cp_enablePhotoGallery">Enable Photo Gallery</label><br />
			<input class="inputNormal" style="width:30px" name="cp_mpPhotoGalCatID" id="cp_mpPhotoGalCatID" type="text" value="'.$this->options["mpPhotoGalCatID"].'" /><label for="cp_mpPhotoGalCatID">Photo Gallery Category ID (Do not leave Empty. If photo gallery is deactivated write an unrealistic category id such as 999999)</label><br />
			
			<h5>Enable / Disable Video on Mainpage Sidebar</h5>
			<input type="checkbox" name="cp_enableVideo" id="cp_enableVideo"'.($this->options["enableVideo"] == 1 ? ' checked' : '').' /><label for="cp_enableVideo">Enable Video on sidebar</label><br />
			<input class="inputNormal" style="width:30px" name="cp_videoCatID" id="cp_videoCatID" type="text" value="'.$this->options["videoCatID"].'" /><label for="cp_videoCatID">Category ID for Videos (Do not leave Empty. If Video is deactivated write an unrealistic category id such as 999998)</label><br />
			<input class="inputNormal" style="width:30px" name="cp_videoPostCount" id="cp_videoPostCount" type="text" value="'.$this->options["videoPostCount"].'" /><label for="cp_videoPostCount">How many videos to be displayed on <strong>mainpage</strong> (Leave empty if Video is not enabled) (default: 1)</label><br />
			<input class="inputNormal" style="width:30px" name="cp_videoPostCountArc" id="cp_videoPostCountArc" type="text" value="'.$this->options["videoPostCountArc"].'" /><label for="cp_videoPostCountArc">How many videos to be displayed on <strong>archive page</strong> (Leave empty if Video is not enabled) (default: 4)</label><br />
		</div>
	
		<div class="optionsWide" id="panel3">
			<h3>Setup Navigation</h3>
			<h5>Setup Navigation Bar: Enter the category IDs those you want to exclude from the navigation bar. <a href="http://www.gabfirethemes.com/how-to-check-category-ids/" target="_blank">Read this post</a> if you dont know how to check ID of a category</h5>
			<input class="inputNormal" style="width:40px" name="cp_excludeCategories" id="cp_excludeCategories" type="text" value="'.$this->options["excludeCategories"].'" /><label for="cp_excludeCategories">Write the ID number of category/categories that you want to exclude from navigation bar on header (leave empty if you dont want to exclude any) (put comma between and leave no space if you enter more than 1 category)</label><br />
			<input class="inputNormal" name="cp_orderBy" id="cp_orderBy" type="text" value="'.$this->options["orderBy"].'" /><label for="cp_orderBy">Sort categories alphabetically, by unique Category ID, or by the count of posts in that Category. Options are <strong>ID</strong>, <strong>name</strong>, <strong>count</strong></label><br />
			<input class="inputNormal" name="cp_order" id="cp_order" type="text" value="'.$this->options["order"].'" /><label for="cp_order">Sort order for categories (either ascending or descending) Options are: <strong>ASC</strong>, <strong>DESC</strong></label><br />
		</div>
	
	
		<div class="optionsWide" id="panel4">
			<h3>Manage Ads</h3>
			<h5 style="margin:0;">Insert 728x90px ad code here (this ad shows only on main page)</h5><textarea name="cp_ad728x90" id="cp_ad728x90" cols="60" rows="5">'.stripslashes($this->options["ad728x90"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">Insert 300x250px ad code here (this ad shows only on main page)</h5><textarea name="cp_ad300x250" id="cp_ad300x250" cols="60" rows="5">'.stripslashes($this->options["ad300x250"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">Insert 250x250px ad code here (this ad shows on every inner page)</h5><textarea name="cp_ad250x250" id="cp_ad160x600" cols="60" rows="5">'.stripslashes($this->options["ad250x250"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">Insert 120x600px ad code here (this ad shows on every inner page)</h5><textarea name="cp_ad120x600" id="cp_ad120x600" cols="60" rows="5">'.stripslashes($this->options["ad120x600"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">If you have activated header with ad, insert 468x60 ad code below - this ad shows on every page</h5><textarea name="cp_adh468x60" id="cp_adh468x60" cols="60" rows="5">'.stripslashes($this->options["adh468x60"]).'</textarea><br />
		</div>		

		<div class="optionsWide" id="panel5">
			<h3>Miscellaneous</h3>
			<h5>Setup Feedburner Email Subscribition</h5>
			<input type="checkbox" name="cp_enableFeedburner" id="cp_enableFeedburner"'.($this->options["enableFeedburner"] == 1 ? ' checked' : '').' /><label style="margin-left: 5px;" for="cp_enableFeedburner"></label>Enable Feedburner Email Subscription Link on Topline (When box is deselected, email link will disapper from the top bar)<br />
			<input class="inputNormal" name="cp_feedburnerID" id="cp_feedburnerID" type="text" value="'.$this->options["feedburnerID"].'" /><label for="cp_feedburnerID">Insert your feedburner ID here (will be used for email subscribtion) (leave empty if feedburner link is disabled)</label><br />
			
			<h5>Breaking News Section (main page left narrow column)</h5>
			<input class="inputNormal" style="width:170px" name="cp_titleBreakingNews" id="cp_titleBreakingNews" type="text" value="'.$this->options["titleBreakingNews"].'" /><label for="cp_titleBreakingNews">Replace the Breaking News title with something else (UPPERCASE recomended)</label><br />
			<input class="inputNormal" style="width:30px" name="cp_breakingNewsPostCount" id="cp_breakingNewsPostCount" type="text" value="'.$this->options["breakingNewsPostCount"].'" /><label for="cp_breakingNewsPostCount">Enter the number of titles to show on Breaking News section (Default: 12)</label><br />
			
		</div>
		

	

	
	Are you done? Then <input type="submit" value="Save Changes &raquo;" name="cp_save" class="dochanges" />
	</fieldset>
    </form></div>';
	}
	
	
	
	function optionsmenu2() {
	if ($_POST['ss_action'] == 'save') {
		$this->options["DGTtitleFirstName"] = $_POST['cp_titleFirstName'];
		$this->options["DGTtitleFirstQuote"] = $_POST['cp_titleFirstQuote'];
		$this->options["DGTquoteFirstImageName"] = $_POST['cp_quoteFirstImageName'];
		$this->options["DGTtitleSecondName"] = $_POST['cp_titleSecondName'];
		$this->options["DGTtitleSecondQuote"] = $_POST['cp_titleSecondQuote'];
		$this->options["DGTquoteSecondImageName"] = $_POST['cp_quoteSecondImageName'];
		$this->options["DGTtitleSiteNameFirstRow"] = $_POST['cp_titleSiteNameFirstRow'];
		$this->options["DGTtitleSiteNameSecondRow"] = $_POST['cp_titleSiteNameSecondRow'];
		$this->options["DGTtitleBreakingNews"] = $_POST['cp_titleBreakingNews'];
		$this->options["DGTbreakingNewsPostCount"] = $_POST['cp_breakingNewsPostCount'];
		$this->options["DGTexcludeCategories"] = $_POST['cp_excludeCategories'];
       	$this->options["DGTenablePhotoGallery"] = isset($_POST['cp_enablePhotoGallery']) ? 1 : 0;
		$this->options["DGTmpPhotoGalCatID"] = $_POST['cp_mpPhotoGalCatID'];
		$this->options["DGTfeaturedCatID"] = $_POST['cp_featuredCatID'];
		$this->options["DGTsub1stCatID"] = $_POST['cp_sub1stCatID'];
		$this->options["DGTsub2ndCatID"] = $_POST['cp_sub2ndCatID'];
		$this->options["DGTsub3rdCatID"] = $_POST['cp_sub3rdCatID'];
		$this->options["DGTsub4thCatID"] = $_POST['cp_sub4thCatID'];
		$this->options["DGTfeedburnerID"] = $_POST['cp_feedburnerID'];
		$this->options["DGTorderBy"] = $_POST['cp_orderBy'];
		$this->options["DGTorder"] = $_POST['cp_order'];
		$this->options["DGTleftQuoteLink"] = $_POST['cp_leftQuoteLink'];
		$this->options["DGTrightQuoteLink"] = $_POST['cp_rightQuoteLink'];		
		$this->options["DGTad120x600"] = stripslashes($_POST['cp_ad120x600']);
		$this->options["DGTad728x90"] = stripslashes($_POST['cp_ad728x90']);
		$this->options["DGTad250x250"] = stripslashes($_POST['cp_ad250x250']);
		$this->options["DGTad300x250"] = stripslashes($_POST['cp_ad300x250']);
		$this->options["DGTadh468x60"] = stripslashes($_POST['cp_adh468x60']);	
		$this->options["DGTvideoPostCount"] = $_POST['cp_videoPostCount'];
		$this->options["DGTvideoPostCountArc"] = $_POST['cp_videoPostCountArc'];
		$this->options["DGTvideoCatID"] = $_POST['cp_videoCatID'];
		$this->options["DGTstyle"] = $_POST['cp_style'];	
		$this->options["DGTenableLinkLeftQ"] = isset($_POST['cp_enableLinkLeftQ']) ? 1 : 0;
		$this->options["DGTenableVideo"] = isset($_POST['cp_enableVideo']) ? 1 : 0;
		$this->options["DGTenableLinkRightQ"] = isset($_POST['cp_enableLinkRightQ']) ? 1 : 0;	
		$this->options["DGTswitchheader"] = isset($_POST['cp_switchheader']) ? 1 : 0;
		$this->options["DGTenableRightQuote"] = isset($_POST['cp_enableRightQuote']) ? 1 : 0;
        update_option('WpNewspaper', $this->options);
	echo '<div class="updated fade" id="message" style="background-color: rgb(255, 251, 204); width: 500px; margin-left: 50px"><p>WpNewspaper settings <strong>saved</strong>.</p></div>';
	}

	echo '
	Modify OK
	<div id="optionsForm">
	<form action="" method="post" id="themeform">
	<fieldset>
    <input type="hidden" id="ss_action" name="ss_action" value="save">	
		<p>Please <strong>do not use non-english</strong> characters on control panel.</p>
	
		<h3>Select Style that you would like to use on your theme</h3>
		<input class="inputNormal" name="cp_style" id="cp_style" type="text" value="'.$this->options["DGTstyle"].'" /><label for="cp_style">Enter the name of style you want to use . Options are <strong>default, default-gray, sans, sans-gray</strong> (cAsE sEnSiTiVe)</label><br /><br />
		
		<div class="optionsWide" id="panel1">
			<h3>Setup Header</h3>
			<p>We have two headers available, one is the current version that you see on <a href="http://www.wpnewspaper.com">live demo</a> that is named as <strong>Header with quotes</strong> and second header where quotes are being removed, the site name is moved to left corner and a 468x60 px ad spot is placed on right side of header. This header is named as <strong>Header with Ads</strong></p>
			<p>Setup header below</p>
			<input class="inputNormal" name="cp_titleSiteNameFirstRow" id="cp_titleSiteNameFirstRow" type="text" value="'.$this->options["DGTtitleSiteNameFirstRow"].'" /><label for="cp_titleSiteNameFirstRow">Enter the sitename that you want to display on first Row (WordPress is shown on live demo) (UPPERCASE is recomended)</label><br />
			<input class="inputNormal" name="cp_titleSiteNameSecondRow" id="cp_titleSiteNameSecondRow" type="text" value="'.$this->options["DGTtitleSiteNameSecondRow"].'" /><label for="cp_titleSiteNameSecondRow">Enter the sitename that you want to display on second row (Newspaper is shown on live demo) (UPPERCASE is recomended)</label><br /><br />
			<input type="checkbox" name="cp_switchheader" id="cp_switchheader"'.($this->options["DGTswitchheader"] == 1 ? ' checked' : '').' /><label for="cp_switchheader">Switch header: When this box is selected, <strong>header with quotes</strong> will be active, when it is not, <strong>header with ad</strong> will be active</label><br />
			
			<div style="padding:10px;border:1px solid #aaa;margin-top:20px;">
				<p class="highlight">If <strong>header with ad</strong> is activated, you dont need to change anything below</p><br />
				
				<input type="checkbox" name="cp_enableLeftQuote" id="cp_enableLeftQuote"'.($this->options["DGTenableLeftQuote"] == 1 ? ' checked' : '').' /><label for="cp_enableLeftQuote">Enable Left Quote on header</label><br />
				<input type="checkbox" name="cp_enableLinkLeftQ" id="cp_enableLinkLeftQ"'.($this->options["DGTenableLinkLeftQ"] == 1 ? ' checked' : '').' /><label for="cp_enableLinkLeftQ">Check this box if you would like to add a link to left quote on header</label><br />
				<input class="inputNormal" name="cp_leftQuoteLink" id="cp_leftQuoteLink" type="text" value="'.$this->options["DGTleftQuoteLink"].'" /><label for="cp_leftQuoteLink">Enter the link for left quote (only if link for left quote activated)</label><br />
				<input class="inputNormal" name="cp_titleFirstName" id="cp_titleFirstName" type="text" value="'.$this->options["DGTtitleFirstName"].'" /><label for="cp_titleFirstName">Enter the text that you want to display in red for the left quote section</label><br />
				<input class="inputNormal" name="cp_titleFirstQuote" id="cp_titleFirstQuote" type="text" value="'.$this->options["DGTtitleFirstQuote"].'" /><label for="cp_titleFirstQuote">Enter the quote for the left section</label><br />
				<input class="inputNormal" name="cp_quoteFirstImageName" id="cp_quoteFirstImageName" type="text" value="'.$this->options["DGTquoteFirstImageName"].'" /><label for="cp_quoteFirstImageName">Image for left quote. Upload your image (not wider than 85px and not higher than 100px) into images folder and write image name here</label><br /><br />
				
				<input type="checkbox" name="cp_enableRightQuote" id="cp_enableRightQuote"'.($this->options["DGTenableRightQuote"] == 1 ? ' checked' : '').' /><label for="cp_enableRightQuote">Enable Right Quote on header</label><br />
				<input type="checkbox" name="cp_enableLinkRightQ" id="cp_enableLinkRightQ"'.($this->options["DGTenableLinkRightQ"] == 1 ? ' checked' : '').' /><label for="cp_enableLinkRightQ">Check this box if you would like to add a link to right quote on header</label><br />
				<input class="inputNormal" name="cp_rightQuoteLink" id="cp_rightQuoteLink" type="text" value="'.$this->options["DGTrightQuoteLink"].'" /><label for="cp_rightQuoteLink">Enter the link for right quote (only if link for right quote activated)</label><br />
				<input class="inputNormal" name="cp_titleSecondName" id="cp_titleSecondName" type="text" value="'.$this->options["DGTtitleSecondName"].'" /><label for="cp_titleSecondName">Enter the text that you want to display in red for the right quote</label><br />
				<input class="inputNormal" name="cp_titleSecondQuote" id="cp_titleSecondQuote" type="text" value="'.$this->options["DGTtitleSecondQuote"].'" /><label for="cp_titleSecondQuote">Enter the quote for the right section</label><br />
				<input class="inputNormal" name="cp_quoteSecondImageName" id="cp_quoteSecondImageName" type="text" value="'.$this->options["DGTquoteSecondImageName"].'" /><label for="cp_quoteSecondImageName">Image for right quote. Upload your image (not wider than 85px and not higher than 100px) into images folder and write image name here</label><br />
			</div>
			
		</div>
		
		<div class="optionsWide" id="panel2">
			<h3>Setup Categories</h3>
			<h5>Enter the ID of categories those are going to show on the homepage. <a href="http://www.gabfirethemes.com/how-to-check-category-ids/" target="_blank">Read this post</a> if you dont know how to check ID of a category</h5>
			<input class="inputNormal" style="width:40px" name="cp_featuredCatID" id="cp_featuredCatID" type="text" value="'.$this->options["DGTfeaturedCatID"].'" /><label for="cp_featuredCatID">Featured area Category ID</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub1stCatID" id="cp_sub1stCatID" type="text" value="'.$this->options["DGTsub1stCatID"].'" /><label for="cp_sub1stCatID">Enter Category ID for first column below the featured photo gallery (Travel section on live demo)</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub2ndCatID" id="cp_sub2ndCatID" type="text" value="'.$this->options["DGTsub2ndCatID"].'" /><label for="cp_sub2ndCatID">Enter Category ID for second column below the featured photo gallery (Politics section on live demo)</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub3rdCatID" id="cp_sub3rdCatID" type="text" value="'.$this->options["DGTsub3rdCatID"].'" /><label for="cp_sub3rdCatID">Enter Category ID for third column below the featured photo gallery (Sports section on live demo)</label><br />
			<input class="inputNormal" style="width:40px" name="cp_sub4thCatID" id="cp_sub4thCatID" type="text" value="'.$this->options["DGTsub4thCatID"].'" /><label for="cp_sub4thCatID">Enter Category ID for fourth column below the featured photo gallery (World News section on live demo)</label><br />
			
			<h5>Enable / Disable Photo Gallery</h5>
			<input type="checkbox" name="cp_enablePhotoGallery" id="cp_enablePhotoGallery"'.($this->options["DGTenablePhotoGallery"] == 1 ? ' checked' : '').' /><label for="cp_enablePhotoGallery">Enable Photo Gallery</label><br />
			<input class="inputNormal" style="width:30px" name="cp_mpPhotoGalCatID" id="cp_mpPhotoGalCatID" type="text" value="'.$this->options["DGTmpPhotoGalCatID"].'" /><label for="cp_mpPhotoGalCatID">Photo Gallery Category ID (Do not leave Empty. If photo gallery is deactivated write an unrealistic category id such as 999999)</label><br />
			
			<h5>Enable / Disable Video on Mainpage Sidebar</h5>
			<input type="checkbox" name="cp_enableVideo" id="cp_enableVideo"'.($this->options["DGTenableVideo"] == 1 ? ' checked' : '').' /><label for="cp_enableVideo">Enable Video on sidebar</label><br />
			<input class="inputNormal" style="width:30px" name="cp_videoCatID" id="cp_videoCatID" type="text" value="'.$this->options["DGTvideoCatID"].'" /><label for="cp_videoCatID">Category ID for Videos (Do not leave Empty. If Video is deactivated write an unrealistic category id such as 999998)</label><br />
			<input class="inputNormal" style="width:30px" name="cp_videoPostCount" id="cp_videoPostCount" type="text" value="'.$this->options["DGTvideoPostCount"].'" /><label for="cp_videoPostCount">How many videos to be displayed on <strong>mainpage</strong> (Leave empty if Video is not enabled) (default: 1)</label><br />
			<input class="inputNormal" style="width:30px" name="cp_videoPostCountArc" id="cp_videoPostCountArc" type="text" value="'.$this->options["DGTvideoPostCountArc"].'" /><label for="cp_videoPostCountArc">How many videos to be displayed on <strong>archive page</strong> (Leave empty if Video is not enabled) (default: 4)</label><br />
		</div>
	
		<div class="optionsWide" id="panel3">
			<h3>Setup Navigation</h3>
			<h5>Setup Navigation Bar: Enter the category IDs those you want to exclude from the navigation bar. <a href="http://www.gabfirethemes.com/how-to-check-category-ids/" target="_blank">Read this post</a> if you dont know how to check ID of a category</h5>
			<input class="inputNormal" style="width:40px" name="cp_excludeCategories" id="cp_excludeCategories" type="text" value="'.$this->options["DGTexcludeCategories"].'" /><label for="cp_excludeCategories">Write the ID number of category/categories that you want to exclude from navigation bar on header (leave empty if you dont want to exclude any) (put comma between and leave no space if you enter more than 1 category)</label><br />
			<input class="inputNormal" name="cp_orderBy" id="cp_orderBy" type="text" value="'.$this->options["DGTorderBy"].'" /><label for="cp_orderBy">Sort categories alphabetically, by unique Category ID, or by the count of posts in that Category. Options are <strong>ID</strong>, <strong>name</strong>, <strong>count</strong></label><br />
			<input class="inputNormal" name="cp_order" id="cp_order" type="text" value="'.$this->options["DGTorder"].'" /><label for="cp_order">Sort order for categories (either ascending or descending) Options are: <strong>ASC</strong>, <strong>DESC</strong></label><br />
		</div>
	
	
		<div class="optionsWide" id="panel4">
			<h3>Manage Ads</h3>
			<h5 style="margin:0;">Insert 728x90px ad code here (this ad shows only on main page)</h5><textarea name="cp_ad728x90" id="cp_ad728x90" cols="60" rows="5">'.stripslashes($this->options["DGTad728x90"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">Insert 300x250px ad code here (this ad shows only on main page)</h5><textarea name="cp_ad300x250" id="cp_ad300x250" cols="60" rows="5">'.stripslashes($this->options["DGTad300x250"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">Insert 250x250px ad code here (this ad shows on every inner page)</h5><textarea name="cp_ad250x250" id="cp_ad160x600" cols="60" rows="5">'.stripslashes($this->options["DGTad250x250"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">Insert 120x600px ad code here (this ad shows on every inner page)</h5><textarea name="cp_ad120x600" id="cp_ad120x600" cols="60" rows="5">'.stripslashes($this->options["DGTad120x600"]).'</textarea><br />
			<h5 style="margin:15px 0 0;">If you have activated header with ad, insert 468x60 ad code below - this ad shows on every page</h5><textarea name="cp_adh468x60" id="cp_adh468x60" cols="60" rows="5">'.stripslashes($this->options["DGTadh468x60"]).'</textarea><br />
		</div>		

		<div class="optionsWide" id="panel5">
			<h3>Miscellaneous</h3>
			<h5>Setup Feedburner Email Subscribition</h5>
			<input type="checkbox" name="cp_enableFeedburner" id="cp_enableFeedburner"'.($this->options["DGTenableFeedburner"] == 1 ? ' checked' : '').' /><label style="margin-left: 5px;" for="cp_enableFeedburner"></label>Enable Feedburner Email Subscription Link on Topline (When box is deselected, email link will disapper from the top bar)<br />
			<input class="inputNormal" name="cp_feedburnerID" id="cp_feedburnerID" type="text" value="'.$this->options["DGTfeedburnerID"].'" /><label for="cp_feedburnerID">Insert your feedburner ID here (will be used for email subscribtion) (leave empty if feedburner link is disabled)</label><br />
			
			<h5>Breaking News Section (main page left narrow column)</h5>
			<input class="inputNormal" style="width:170px" name="cp_titleBreakingNews" id="cp_titleBreakingNews" type="text" value="'.$this->options["DGTtitleBreakingNews"].'" /><label for="cp_titleBreakingNews">Replace the Breaking News title with something else (UPPERCASE recomended)</label><br />
			<input class="inputNormal" style="width:30px" name="cp_breakingNewsPostCount" id="cp_breakingNewsPostCount" type="text" value="'.$this->options["DGTbreakingNewsPostCount"].'" /><label for="cp_breakingNewsPostCount">Enter the number of titles to show on Breaking News section (Default: 12)</label><br />
			
		</div>
		

	

	
	Are you done? Then <input type="submit" value="Save Changes &raquo;" name="cp_save" class="dochanges" />
	</fieldset>
    </form></div>';
	}
	/********************************************************
	END
	********************************************************/
}

/********************************************************
New Control Panel - Do not remove!
********************************************************/
$cpanel = new ControlPanel();
$theme_options = get_option('WpNewspaper');

function showthumb() {

	global $theme_options;

	if($theme_options['thumb'] == 1) {
	echo get_the_image(array('Thumbnail','My Thumbnail'),'thumbnail');
	} else {
	}

}

function showthumb_i() {

	global $theme_options;

	if($theme_options['thumb_sub'] == 1 && $theme_options['thumb'] == 1) {
	echo get_the_image(array('Thumbnail','My Thumbnail'),'thumbnail');
	} else {
	}

}
?>